Page({
  onLoad({ id }) {
    console.log(id);
    this.getPassPort(id)
  },
  onShareAppMessage() {
    return {
      title: '查看通行证',
      path: '/visitor_pkg/pages/passport/index',
      imageUrl: 'https://enjoy-plus.oss-cn-beijing.aliyuncs.com/images/share_poster.png',
    }
  },
  //获取通行证
  async getPassPort(id) {
    const res = await wx.http.get(`/visitor/${id}`)
    console.log(res.data);
    this.setData({
      ...res.data
    })
  },
  //把图片保存到本地
  async savePicture() {
    const { path } = await wx.getImageInfo({
      src: this.data.url
    })
    console.log(path);
    wx.saveImageToPhotosAlbum({
      filePath: path,
      success: () => {
        wx.utils.toast('保存成功')
      }
    })

  }
})
